-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Go straight to inbox on launch, when an account available #525
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gnprice
force-pushed
the
pr-launch-inbox
branch
from
February 17, 2024 02:18
385481f
to
2697014
Compare
This doesn't particularly have a "page" nature; it'd work just as well as one thing on a larger page, if it came to that.
I was rereading some of the code that uses these classes, and found I had to reread their implementation to refresh myself on what they each did.
In particular this provides a back button so that the user can go try something else instead of waiting for the app to finish getting data from the server. (On Android the user could already do so, using the system back gesture or button, but there's no such thing on iOS.)
Now PerAccountStoreWidget has just two constructor call sites in the app. There's one for the flight shuttle in LightboxHero, a rare example of a widget not belonging to any page; and then the one in AccountPageRouteMixin covers every page in the app that needs a per-account store.
This has the same effect, but gives us a more general form of API to work with for more complex effects. Effectively `onGenerateRoute` is a fallback for when a route name isn't resolved by `home` or `routes`; and this version has the same effect as the `home` (and omitted `routes`) we'd been providing. I find the relevant area of the docs somewhat hard to follow, so to see this in the implementation: the main effects of both `home` and `onGenerateRoute` are implemented in [WidgetsApp._onGenerateRoute], and the one other effect is in [WidgetsApp._usesNavigator]. The [MaterialWidgetRoute] part corresponds to `pageRouteBuilder`, which is specified by the [MaterialApp] implementation.
The base class offers six methods, so we may as well provide access to all six of them in the same way.
This mimics what the default implementation of onGenerateInitialRoutes was doing, given that we never specify initialRoute and given our implementation of onGenerateRoute.
This will let us use the global store in computing our arguments for MaterialApp.
These tests had been relying on the fact that there wouldn't be any PerAccountStoreWidget that reached the point of attempting to load data for these accounts. But that was true only because, after opening a notification, the test code waited only for microtasks (with `await null`), and not for a new frame (like `tester.pump()`). That makes them brittle, as they'd break on an otherwise innocent change to pump another frame. Fortunately it's easy to fix.
This looks great! Merging. It probably bumps the priority of #386, because the inbox page will be featured more prominently now. But even an empty inbox page has a title and a back button, so users shouldn't be totally stuck, and we do still clearly mark the app as beta. |
chrisbobbe
force-pushed
the
pr-launch-inbox
branch
from
February 22, 2024 00:28
2697014
to
256fa7e
Compare
Thanks!
Good point, yeah, agreed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #516
Along the way, make some improvements to our abstractions for describing a page that needs a
PerAccountStoreWidget
(likeMaterialAccountWidgetRoute
). In particular:PerAccountStoreWidget
to use a loading placeholder that has aScaffold
and therefore a back button.